#makefile of latex sunqi

QBOOK = qpedia
VERS = 0.2

FILES = src/qpedia.tex src/qpedia.sty src/qpedia.ist \
	src/title-q.tex \
	src/ack.tex src/preface.tex \
	src/ptlife.tex \
	src/ch1.tex src/ch2.tex src/ch3.tex \
	src/ptcomm.tex \
	src/ch4.tex src/ch5.tex \
	src/ptlatex.tex \
	src/ch6.tex \
	src/afterword.tex \
	src/appendix.tex \
	src/biblio1.tex src/ref.bib 

OTHERS = README INSTALL CREDITS

	
#define some varibles
SHELL = /bin/sh
LATEX = latex
PDFLATEX = pdflatex
BIBTEX = bibtex
MAKEINDEX = makeindex
DVIPS = dvips
THUMBPDF = thumbpdf --resolution 10

#the default targets
all: $(QBOOK).pdf

$(QBOOK).pdf: $(FILES)
	-mkdir pdfsbox
	( cp src/* pdfsbox/ && \
	cd pdfsbox && \
	$(PDFLATEX) $(QBOOK) && \
	$(BIBTEX) $(QBOOK) && \
	$(PDFLATEX) $(QBOOK) && \
	$(PDFLATEX) $(QBOOK) && \
	$(MAKEINDEX) -s $(QBOOK).ist $(QBOOK) && \
	$(PDFLATEX) $(QBOOK) && \
	( $(THUMBPDF) $(QBOOK).pdf && \
	$(PDFLATEX) $(QBOOK) && \
	$(PDFLATEX) $(QBOOK) )&& \
	mv $(QBOOK).pdf .. )
	

.PHONY: all 
	 
clean:
	rm -rf pdfsbox

distclean:
	rm -rf pdfsbox *.pdf *.ps *.dvi

vw:$(QBOOK).pdf
	evince $(QBOOK).pdf



